const { getToken } = require("@/utils")
const { Navigate } = require("react-router-dom")

// 有token正常跳转，无token去登录页面
export const AuthRoute = ({children}) =>{
    const token = getToken()
    if(token){
        return (
            <>
                {children}
            </>
        )
    }else{
        return <Navigate to={'/login'} replace></Navigate>
    }
}